
<template>
  <div id="confirmTrade" class="single_page">
  </div>
</template>
<style type="text/css" lang="less" >
</style>
<script>
import {get,compNav} from '../../public/js/utils.js'
import Swal from 'sweetalert'
export default {
  data: function () {
    return {
      zone:{},
      timerinfo:''
    }
  },
  props:['user','data'],
  components:{
  },
  mounted:async function(){
    this.init()
  },
  beforeDestroy(){
    clearInterval(this.timerinfo);
  },
  methods:{
    async init(){
      compNav(this)
      var h = '<div class="flowTitle"><a >  确认订单 </a></div>';
      h += '<p>车位自动解锁还有 <span class="second2">15</span> 秒</p>';

      var codeStr = '';
      var priceStr = '';
      var arr = this.data;
      // if(g_stage.multi){
      //     arr = g_carArr;
      //     uiHide($('#chooseList'));
      // }
      var exPriceDefine = $('#exPriceDefine').val();
      if(exPriceDefine){
        exPriceDefine = JSON.parse(exPriceDefine);
      }
      arr.forEach(function(o){
      h += '<center><table class="table" width="100%"><tr><td>车位号</td><td>'+(o.showName||o.prakingnum)+'</td></tr>';
        h+= '<tr><td>原价/元</td><td>'+(o.price||'待定')+'</td></tr>';
        if(exPriceDefine){
          var exPrice = {};
          if(o.car.exPrice){
            exPrice = JSON.parse(o.car.exPrice);
          }
          for(var i in exPriceDefine){
            h+='<tr><td>'+exPriceDefine[i]+'</td><td>'+(exPrice[i]||'待定')+'</td></tr>';
          }
        }
        h+='</table></center>';
      });
      h += '<div class="box"><a id="tconfirm" class="button button-orange button-diy">确定</a><a id="tcancel" class="button button-orange button-diy">取消</a></div>';
      $('#confirmTrade').html(h);
      $('#tconfirm').unbind('click').click(function(){
        // if(confirm('认购成功后，视为认购人成功购买已认购车位，不能更换、退订车位')){
        //  miaoshaogood();
        // }
        Swal({
          title: "",
          text: "<p>距离自动解锁还剩：<font class=\"red second2\">00</font>秒</p><br/>选择成功后，视为业主成功预选该车位，不能更换、退选车位。",
          html: true
          ,type: "info",
          showCancelButton: true,
          closeOnConfirm: false
          ,confirmButtonText:'确定'
          ,cancelButtonText:'取消'
          // showLoaderOnConfirm: true,
        },function(){
          // miaoshaogood();
        });
      });
      $('#tcancel').unbind('click').click(function(){
        back()
      });
    },
    back(){
      this.$parent.back()
    }
  }

}
</script>
